# -*- makefile -*- for the C-level run-time support for SBCL

# This software is part of the SBCL system. See the README file for
# more information.
#
# This software is derived from the CMU CL system, which was
# written at Carnegie Mellon University and released into the
# public domain. The software is in the public domain and is
# provided with absolutely no warranty. See the COPYING and CREDITS
# files for more information.

ASSEM_SRC = x86-assem.S
ARCH_SRC = x86-arch.c
OS_SRC = linux-os.c linux-mman.c x86-linux-os.c

# The "--Wl,--export-dynamic" flags are here to help people
# experimenting with callbacks from C to SBCL, by allowing linkage to
# SBCL src/runtime/*.c symbols from C. Work on this is good, but it's
# definitely bleeding edge and not particularly stable. In particular,
# not only are the workarounds for the GC relocating Lisp code and
# data unstable, but even the basic calling convention might end up
# being unstable. Unless you want to do some masochistic maintenance
# work when new releases of SBCL come out, please don't try to build
# real code on this until a coherent stable interface has been added.
# (You *are* encouraged to design and implement a coherent stable
# interface, though.:-| As far as I (WHN 2002-05-19) know, no one is
# working on one and it would be a nice thing to have.)
LINKFLAGS += -Wl,--export-dynamic -m32
OS_LIBS = -ldl
__LDFLAGS__ = -m elf_i386


ifdef LISP_FEATURE_LARGEFILE
  CFLAGS += -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
endif
CFLAGS += -m32 -fno-omit-frame-pointer

ifdef LISP_FEATURE_SB_THREAD
  OS_LIBS += -lpthread
endif
ifdef LISP_FEATURE_SB_CORE_COMPRESSION
  OS_LIBS += -lzstd
endif
ifdef HAVE_LIBUNWIND
  OS_LIBS += -lunwind
endif
ifdef LISP_FEATURE_SB_LINKABLE_RUNTIME
  LIBSBCL = sbcl.o
  USE_LIBSBCL = sbcl.o
endif

GC_SRC = fullcgc.c gencgc.c traceroot.c
